
//被abstract修饰的类成为抽象类
//抽象类就是为了被继承
abstract class Shape{

    //抽象类可以包含普通成员变量和普通成员方法
    public int x;
    //被abstract修饰的方法称为抽象方法
    //该方法没有具体的实现
    public abstract void draw();

    public void func(){

    }
}
//普通类继承抽象类之后，子类必须重写抽象类中所有的抽象方法
class Rect extends Shape{
    @Override
    public void draw() {
        System.out.println("▅");
    }
}

class Flower extends Shape{
    @Override
    public void draw() {
        System.out.println("❀");
    }
}

class Cycle extends Shape{
    @Override
    public void draw() {
        System.out.println("○");
    }
}
public class Test {
    public static void drawMap(Shape shape){
        shape.draw();
    }
    public static void main(String[] args) {

        //抽象类不可以实例化对象
        //Shape shape = new Shape() ;//error

        Shape shape = new Rect();
        drawMap(new Rect());
        drawMap(new Flower());
        drawMap(new Cycle());
    }
}
